geom_hline(yintercept = 0, color = "gray50", linetype = 2, size = 0.2) +
geom_pointrange(aes(ymin = conf.low, ymax = conf.high),
position = position_dodge(width = 0.6)) +
geom_text(aes(label = round(estimate, digits = 2)),
family = "Times",
position = position_dodge(width = 0.6),  # Align text with points
hjust = -0.6,
show_guide  = FALSE) +
scale_colour_grey()+
scale_x_discrete(limits= order_x) +
labs(x = "Outcome",
y = "Effect Size of Shaming") +
guides(text = "none") +
theme(text = element_text(size = 16, family = "Times"),
legend.key=element_blank(),
axis.text.x = element_text(color = c("gray50", "gray50", "gray50",
"black","black", "black"), size = 14, margin = margin(0,0,20,0)),
panel.grid.major = element_blank(),
plot.caption = element_text(size = 14, family = "Times",hjust = -.02),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
axis.line = element_line(colour = "black"))
ggsave("Figures/H12ab.pdf", width = 10, height = 5)
#Test H2c (Does the relationship with the shamer moderate H2a, H2bA, or H2bB?)
##favorability
H2c_Aally<-lm_robust(shamer_favorability~shaming,sham_ally)%>% tidy %>%
mutate(.,
outcome = "Favorability \n (Shamer)",
Towards = "shamer",
Shamer = "U.S. Ally")
H2c_Aenemy<-lm_robust(shamer_favorability~shaming,sham_enemy)%>% tidy %>%
mutate(.,
outcome = "Favorability \n (Shamer)",
Towards = "shamer",
Shamer = "U.S. Enemy")
##military
H2c_Bally<-lm_robust(shamer_military~shaming,sham_ally)%>% tidy %>%
mutate(.,
outcome = "Military Coop. \n (Shamer)",
Towards = "shamer",
Shamer = "U.S. Ally")
H2c_Benemy<-lm_robust(shamer_military~shaming,sham_enemy)%>% tidy %>%
mutate(.,
outcome = "Military Coop. \n (Shamer)",
Towards = "shamer",
Shamer = "U.S. Enemy")
##economic
H2c_Cally<-lm_robust(shamer_economic~shaming,sham_ally)%>% tidy %>%
mutate(.,
outcome = "Economic Coop. \n (Shamer)",
Towards = "shamer",
Shamer = "U.S. Ally")
H2c_Cenemy<-lm_robust(shamer_economic~shaming,sham_enemy)%>% tidy %>%
mutate(.,
outcome = "Economic Coop. \n (Shamer)",
Towards = "shamer",
Shamer = "U.S. Enemy")
#plot H1c and H2c results
#Plot H1a, H1b, H2a, H2b
main_H12c <- rbind(H1c_Aally, H1c_Aenemy,
H1c_Bally, H1c_Benemy,
H1c_Cally, H1c_Cenemy,
H2c_Aally, H2c_Aenemy,
H2c_Bally, H2c_Benemy,
H2c_Cally, H2c_Cenemy) %>%
filter(.,
term == "shaming")
# Generate main_H12c plot
ggplot(main_H12c, aes(x = outcome, y = estimate, colour = Shamer, shape = Shamer)) +
geom_hline(yintercept = 0, color = "gray50", linetype = 2, size = 0.2) +
geom_pointrange(aes(ymin = conf.low, ymax = conf.high),
position = position_dodge(width = 0.6)) +
geom_text(aes(label = round(estimate, digits = 2)),
family = "Times",
position = position_dodge(width = 0.6),  # Align text with points
hjust = -0.6,
show_guide  = FALSE) +
scale_color_manual(values = c("dodgerblue2","firebrick2")) +
scale_fill_manual(values = c("dodgerblue2","firebrick2")) +
#scale_colour_grey()+
scale_x_discrete(limits= order_x) +
labs(x = "Outcome",
y = "Effect Size of Shaming") +
guides(text = "none") +
theme(text = element_text(size = 16, family = "Times"),
legend.key=element_blank(),
axis.text.x = element_text(color = c("gray50", "gray50", "gray50",
"black","black", "black"), size = 14, margin = margin(0,0,20,0)),
panel.grid.major = element_blank(),
plot.caption = element_text(size = 14, family = "Times",hjust = -.02),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
axis.line = element_line(colour = "black"))
ggsave("Figures/H12c.pdf", width = 14, height = 5)
#report interaction terms of H2c in table form
##H2c_A:favorability
H2c_A<-lm(shamer_favorability~shaming*shamer_ally,data)
##H2c_B:military cooperation
H2c_B<-lm(shamer_military~shaming*shamer_ally,data)
##H2c_C:economic cooperation
H2c_C<-lm(shamer_economic~shaming*shamer_ally,data)
#with controls
H2c_Acontrols<-lm(shamer_favorability~shaming*shamer_ally+
Democrat+Republican+Independent+
Educated+Black+White+Asian+Native+Other+Religious+
Female+Age+Political_interest+Conservative+hawk1+hawk2+
hawk3+hawk4+state,data)
H2c_Bcontrols<-lm(shamer_military~shaming*shamer_ally+
Democrat+Republican+Independent+
Educated+Black+White+Asian+Native+Other+Religious+
Female+Age+Political_interest+Conservative+hawk1+hawk2+
hawk3+hawk4+state,data)
H2c_Ccontrols<-lm(shamer_economic~shaming*shamer_ally+
Democrat+Republican+Independent+
Educated+Black+White+Asian+Native+Other+Religious+
Female+Age+Political_interest+Conservative+hawk1+hawk2+
hawk3+hawk4+state,data)
#save table of interaction terms
#Create table
tab1<-stargazer(H1c_A, H1c_B, H1c_C,H2c_A, H2c_B, H2c_C,
out= "Tables/H12c.tex",  style="qje",
title="Heterogeneous treatmet effect of shaming*shamer ally",
keep = c("shaming", "shamer_ally","shaming:shamer_ally"),
dep.var.labels = c("Favorability (Target)", "Military Coop. (Target)",
"Economic Coop. (Target)",
"Favorability (Shamer)","Military Coop. (Shamer)",
"Economic Coop. (Shamer)"),
covariate.labels = c("Shaming", "Shamer Ally", "Shaming*Shamer Ally"),
omit.stat = c("rsq", "f", "ser", "adj.rsq"),
star.cutoffs = NULL,
label = "tab:H12c",
# star.char = c("", "", ""),
ci=FALSE,
omit.table.layout = NULL,
notes.append = FALSE,
notes.align = "l",
notes = c(""))
note.latex <- "\\multicolumn{7}{c} {\\parbox[t]{14cm}{ \\textit{Notes:}
* $p < .1$, ** $p < .05$, *** $p < .01$}} \\\\"
tab1[grepl("Note",tab1)] <- note.latex
tab1 <- gsub("\\begin{tabular}"
,"\\resizebox{1.1\\textwidth}{!}{\n\\begin{tabular}"
,tab1
,fixed=T)
tab1 <- gsub("\\end{tabular}"
,"\\end{tabular}}"
,tab1
,fixed=T)
cat(tab1, sep = "\n")
write(tab1, 'Tables/H12c.tex')
#save table with controls
#Create table -- H1c controls
tab1<-stargazer(H1c_Acontrols, H1c_Bcontrols,
H1c_Ccontrols,
out= "Tables/H1cControls.tex",  style="qje",
title="Testing H1c with controls",
keep = c("shaming", "shamer_ally","shaming:shamer_ally"),
dep.var.labels = c("Favorability (Target)", "Military Coop. (Target)",
"Economic Coop. (Target)"),
covariate.labels = c("Shaming", "Shamer Ally", "Shaming*Shamer Ally"),
omit.stat = c("rsq", "f", "ser", "adj.rsq"),
star.cutoffs = NULL,
label = "tab:H1cControls",
# star.char = c("", "", ""),
ci=FALSE,
omit.table.layout = NULL,
notes.append = FALSE,
notes.align = "l",
notes = c(""))
note.latex <- "\\multicolumn{4}{c} {\\parbox[t]{14cm}{ \\textit{Notes:}
* $p < .1$, ** $p < .05$, *** $p < .01$}} \\\\"
tab1[grepl("Note",tab1)] <- note.latex
tab1 <- gsub("\\begin{tabular}"
,"\\resizebox{1.1\\textwidth}{!}{\n\\begin{tabular}"
,tab1
,fixed=T)
tab1 <- gsub("\\end{tabular}"
,"\\end{tabular}}"
,tab1
,fixed=T)
cat(tab1, sep = "\n")
write(tab1, 'Tables/H1cControls.tex')
#Create table -- H2c controls
tab1<-stargazer(H2c_Acontrols, H2c_Bcontrols, H2c_Ccontrols,
out= "Tables/H2cControls.tex",  style="qje",
title="Testing H2c with controls",
keep = c("shaming", "shamer_ally","shaming:shamer_ally"),
dep.var.labels = c("Favorability (Shamer)","Military Coop. (Shamer)",
"Economic Coop. (Shamer)"),
covariate.labels = c("Shaming", "Shamer Ally", "Shaming*Shamer Ally"),
omit.stat = c("rsq", "f", "ser", "adj.rsq"),
star.cutoffs = NULL,
label = "tab:H2cControls",
# star.char = c("", "", ""),
ci=FALSE,
omit.table.layout = NULL,
notes.append = FALSE,
notes.align = "l",
notes = c(""))
note.latex <- "\\multicolumn{4}{c} {\\parbox[t]{14cm}{ \\textit{Notes:}
* $p < .1$, ** $p < .05$, *** $p < .01$}} \\\\"
tab1[grepl("Note",tab1)] <- note.latex
tab1 <- gsub("\\begin{tabular}"
,"\\resizebox{1.1\\textwidth}{!}{\n\\begin{tabular}"
,tab1
,fixed=T)
tab1 <- gsub("\\end{tabular}"
,"\\end{tabular}}"
,tab1
,fixed=T)
cat(tab1, sep = "\n")
write(tab1, 'Tables/H2cControls.tex')
#Test H2d (Does the relationship with the shamer moderate H2a, H2bA, or 21bB?)
##favorability
H2d_Aally<-lm_robust(shamer_favorability~shaming,tar_ally)%>% tidy %>%
mutate(.,
outcome = "Favorability \n (Shamer)",
Towards = "shamer",
Target = "U.S. Ally")
H2d_Aenemy<-lm_robust(shamer_favorability~shaming,tar_enemy)%>% tidy %>%
mutate(.,
outcome = "Favorability \n (Shamer)",
Towards = "shamer",
Target = "U.S. Enemy")
##military
H2d_Bally<-lm_robust(shamer_military~shaming,tar_ally)%>% tidy %>%
mutate(.,
outcome = "Military Coop. \n (Shamer)",
Towards = "shamer",
Target = "U.S. Ally")
H2d_Benemy<-lm_robust(shamer_military~shaming,tar_enemy)%>% tidy %>%
mutate(.,
outcome = "Military Coop. \n (Shamer)",
Towards = "shamer",
Target = "U.S. Enemy")
##economic
H2d_Cally<-lm_robust(shamer_economic~shaming,tar_ally)%>% tidy %>%
mutate(.,
outcome = "Economic Coop. \n (Shamer)",
Towards = "shamer",
Target = "U.S. Ally")
H2d_Cenemy<-lm_robust(shamer_economic~shaming,tar_enemy)%>% tidy %>%
mutate(.,
outcome = "Economic Coop. \n (Shamer)",
Towards = "shamer",
Target = "U.S. Enemy")
#plot H1c and H2c results
#Plot H1a, H1b, H2a, H2b
main_H12d <- rbind(H1d_Aally, H1d_Aenemy,
H1d_Bally, H1d_Benemy,
H1d_Cally, H1d_Cenemy,
H2d_Aally, H2d_Aenemy,
H2d_Bally, H2d_Benemy,
H2d_Cally, H2d_Cenemy) %>%
filter(.,
term == "shaming")
# Generate main_H12d plot
ggplot(main_H12d, aes(x = outcome, y = estimate, colour = Target, shape = Target)) +
geom_hline(yintercept = 0, color = "gray50", linetype = 2, size = 0.2) +
geom_pointrange(aes(ymin = conf.low, ymax = conf.high),
position = position_dodge(width = 0.6)) +
geom_text(aes(label = round(estimate, digits = 2)),
family = "Times",
position = position_dodge(width = 0.6),  # Align text with points
hjust = -0.6,
show_guide  = FALSE) +
scale_color_manual(values = c("dodgerblue2","firebrick2")) +
scale_fill_manual(values = c("dodgerblue2","firebrick2")) +
#scale_colour_grey()+
scale_x_discrete(limits= order_x) +
labs(x = "Outcome",
y = "Effect Size of Shaming") +
guides(text = "none") +
theme(text = element_text(size = 16, family = "Times"),
legend.key=element_blank(),
axis.text.x = element_text(color = c("gray50", "gray50", "gray50",
"black","black", "black"), size = 14, margin = margin(0,0,20,0)),
panel.grid.major = element_blank(),
plot.caption = element_text(size = 14, family = "Times",hjust = -.02),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
axis.line = element_line(colour = "black"))
ggsave("Figures/H12d.pdf", width = 14, height = 5)
#report interaction terms of H2d in table
##H2d_A:favorability
H2d_A<-lm(shamer_favorability~shaming*target_ally,data)
##H2d_B:military cooperation
H2d_B<-lm(shamer_military~shaming*target_ally,data)
##H2d_C:economic cooperation
H2d_C<-lm(shamer_economic~shaming*target_ally,data)
#with controls
H2d_Acontrols<-lm(shamer_favorability~shaming*target_ally+
Democrat+Republican+Independent+
Educated+Black+White+Asian+Native+Other+Religious+
Female+Age+Political_interest+Conservative+hawk1+hawk2+
hawk3+hawk4+state,data)
H2d_Bcontrols<-lm(shamer_military~shaming*target_ally+
Democrat+Republican+Independent+
Educated+Black+White+Asian+Native+Other+Religious+
Female+Age+Political_interest+Conservative+hawk1+hawk2+
hawk3+hawk4+state,data)
H2d_Ccontrols<-lm(shamer_economic~shaming*target_ally+
Democrat+Republican+Independent+
Educated+Black+White+Asian+Native+Other+Religious+
Female+Age+Political_interest+Conservative+hawk1+hawk2+
hawk3+hawk4+state,data)
#save table of interaction terms
#Create table
tab2<-stargazer(H1d_A, H1d_B, H1d_C,
H2d_A, H2d_B, H2d_C,
out= "Tables/H12d.tex",  style="qje",
title="Heterogeneous treatmet effect of shaming*target ally",
keep = c("shaming", "target_ally","shaming:target_ally"),
dep.var.labels = c("Favorability (Target)", "Military Coop. (Target)",
"Economic Coop. (Target)",
"Favorability (Shamer)","Military Coop. (Shamer)",
"Economic Coop. (Shamer)"),
covariate.labels = c("Shaming", "Target Ally", "Shaming*Target Ally"),
omit.stat = c("rsq", "f", "ser", "adj.rsq"),
star.cutoffs = NULL,
label = "tab:H12d",
# star.char = c("", "", ""),
ci=FALSE,
omit.table.layout = NULL,
notes.append = FALSE,
notes.align = "l",
notes = c(""))
note.latex <- "\\multicolumn{7}{c} {\\parbox[t]{14cm}{ \\textit{Notes:}
* $p < .1$, ** $p < .05$, *** $p < .01$}} \\\\"
tab2[grepl("Note",tab2)] <- note.latex
tab2 <- gsub("\\begin{tabular}"
,"\\resizebox{1.1\\textwidth}{!}{\n\\begin{tabular}"
,tab2
,fixed=T)
tab2 <- gsub("\\end{tabular}"
,"\\end{tabular}}"
,tab2
,fixed=T)
cat(tab2, sep = "\n")
write(tab2, 'Tables/H12d.tex')
#save table with controls
#Create table -- H1d controls
tab2<-stargazer(H1d_Acontrols, H1d_Bcontrols, H1d_Ccontrols,
out= "Tables/H1dcontrols.tex",  style="qje",
title="Testing H1d with Controls",
keep = c("shaming", "target_ally","shaming:target_ally"),
dep.var.labels = c("Favorability (Target)", "Military Coop. (Target)",
"Economic Coop. (Target)"),
covariate.labels = c("Shaming", "Target Ally", "Shaming*Target Ally"),
omit.stat = c("rsq", "f", "ser", "adj.rsq"),
star.cutoffs = NULL,
label = "tab:H1dcontrols",
# star.char = c("", "", ""),
ci=FALSE,
omit.table.layout = NULL,
notes.append = FALSE,
notes.align = "l",
notes = c(""))
note.latex <- "\\multicolumn{4}{c} {\\parbox[t]{14cm}{ \\textit{Notes:}
* $p < .1$, ** $p < .05$, *** $p < .01$}} \\\\"
tab2[grepl("Note",tab2)] <- note.latex
tab2 <- gsub("\\begin{tabular}"
,"\\resizebox{1.1\\textwidth}{!}{\n\\begin{tabular}"
,tab2
,fixed=T)
tab2 <- gsub("\\end{tabular}"
,"\\end{tabular}}"
,tab2
,fixed=T)
cat(tab2, sep = "\n")
write(tab2, 'Tables/H1dcontrols.tex')
#save table with controls
#Create table -- H2d controls
tab2<-stargazer(H2d_Acontrols, H2d_Bcontrols, H2d_Ccontrols,
out= "Tables/H2dcontrols.tex",  style="qje",
title="Testing H2d with Controls",
keep = c("shaming", "target_ally","shaming:target_ally"),
dep.var.labels = c("Favorability (Shamer)","Military Coop. (Shamer)",
"Economic Coop. (Shamer)"),
covariate.labels = c("Shaming", "Target Ally", "Shaming*Target Ally"),
omit.stat = c("rsq", "f", "ser", "adj.rsq"),
star.cutoffs = NULL,
label = "tab:H2dcontrols",
# star.char = c("", "", ""),
ci=FALSE,
omit.table.layout = NULL,
notes.append = FALSE,
notes.align = "l",
notes = c(""))
note.latex <- "\\multicolumn{4}{c} {\\parbox[t]{14cm}{ \\textit{Notes:}
* $p < .1$, ** $p < .05$, *** $p < .01$}} \\\\"
tab2[grepl("Note",tab2)] <- note.latex
tab2 <- gsub("\\begin{tabular}"
,"\\resizebox{1.1\\textwidth}{!}{\n\\begin{tabular}"
,tab2
,fixed=T)
tab2 <- gsub("\\end{tabular}"
,"\\end{tabular}}"
,tab2
,fixed=T)
cat(tab2, sep = "\n")
write(tab2, 'Tables/H2dcontrols.tex')
#Test H3 (Does shaming decrease/increase support for international norms?)#
##H3a: detention
H3a<- lm_robust(detention_new~shaming, data = data)%>% tidy %>%
mutate(.,
outcome = "Oppose \n Arbitrary Detention")
##H3b: human rights
H3b<- lm_robust(HRs_new~shaming, data = data)%>% tidy %>%
mutate(.,
outcome = "Support \n Human Rights")
##H3c: human rights
H3c<- lm_robust(law_new~shaming, data = data)%>% tidy %>%
mutate(.,
outcome = "Support \n International Law")
##H3d: index
H3d<- lm_robust(H3_index~shaming, data = data)%>% tidy %>%
mutate(.,
outcome = "Index")
#add controls
H3acontrols<- lm(detention_new~shaming+
Democrat+Republican+Independent+
Educated+Black+White+Asian+Native+Other+Religious+
Female+Age+Political_interest+Conservative+hawk1+hawk2+
hawk3+hawk4+state, data)
H3bcontrols<- lm(HRs_new~shaming+
Democrat+Republican+Independent+
Educated+Black+White+Asian+Native+Other+Religious+
Female+Age+Political_interest+Conservative+hawk1+hawk2+
hawk3+hawk4+state, data)
H3ccontrols<- lm(law_new~shaming+
Democrat+Republican+Independent+
Educated+Black+White+Asian+Native+Other+Religious+
Female+Age+Political_interest+Conservative+hawk1+hawk2+
hawk3+hawk4+state, data)
H3dcontrols<- lm(H3_index~shaming+
Democrat+Republican+Independent+
Educated+Black+White+Asian+Native+Other+Religious+
Female+Age+Political_interest+Conservative+hawk1+hawk2+
hawk3+hawk4+state, data)
summary(H3bcontrols)
#Plot H3
main_H3 <- rbind(H3a, H3b, H3c, H3d) %>%
filter(.,
term == "shaming")
order_x <- c("Oppose \n Arbitrary Detention", "Support \n Human Rights",
"Support \n International Law", "Index")
# Generate coefficient plot
ggplot(main_H3, aes(x = outcome, y = estimate)) +
geom_hline(yintercept = 0, color = "gray50", linetype = 2, size = 0.2) +
geom_pointrange(aes(ymin = conf.low, ymax = conf.high),
position = position_dodge(width = 0.4),
fill = "white") +
geom_text(aes(label= round(estimate, digits = 2)), hjust=-.7, size = 3,
family = "Times") +
#geom_text(aes(label= paste("(",round(std.error, digits = 1),")")), hjust=-.2, vjust =2 ,  size = 3,
#        family = "Times") +
#coord_flip()+
labs(x = "",
y = "Effect Size of Shaming") +
scale_x_discrete(limits= order_x) +
theme(text = element_text(size = 10, family = "Times"),
legend.key=element_blank(),
panel.grid.major = element_blank(),
axis.text.x = element_text(size = 10),
plot.caption = element_text(size = 10, family = "Times",hjust = -.02),
panel.grid.minor = element_blank(),
panel.background = element_blank(),
axis.line = element_line(colour = "black"))
ggsave("Figures/H3.pdf", width = 10, height = 5)
#save table with controls
#save table with controls
#Create table -- H3 controls
tab2<-stargazer(H3acontrols, H3bcontrols, H3ccontrols, H3dcontrols,
out= "Tables/H3controls.tex",  style="qje",
title="Testing H3 with Controls",
keep = "shaming",
dep.var.labels = c("Oppose Arbitrary Detention", "Support HRs",
"Support Int. Law", "Index"),
covariate.labels = "Shaming",
omit.stat = c("rsq", "f", "ser", "adj.rsq"),
star.cutoffs = NULL,
label = "tab:H3controls",
# star.char = c("", "", ""),
ci=FALSE,
omit.table.layout = NULL,
notes.append = FALSE,
notes.align = "l",
notes = c(""))
note.latex <- "\\multicolumn{5}{c} {\\parbox[t]{14cm}{ \\textit{Notes:}
* $p < .1$, ** $p < .05$, *** $p < .01$}} \\\\"
tab2[grepl("Note",tab2)] <- note.latex
tab2 <- gsub("\\begin{tabular}"
,"\\resizebox{1.1\\textwidth}{!}{\n\\begin{tabular}"
,tab2
,fixed=T)
tab2 <- gsub("\\end{tabular}"
,"\\end{tabular}}"
,tab2
,fixed=T)
cat(tab2, sep = "\n")
write(tab2, 'Tables/H3controls.tex')
## ----------------------------------------------------------------------
# In-text discussion
# ----------------------------------------------------------------------
not_shamed <- data[ which(data$shaming==0), ]#control respondents (baseline)
#mean attitude towards ally-shamers, control
not_shamed_ally <- not_shamed[ which(not_shamed$shamer_ally==1), ]
mean(not_shamed_ally$shamer_favorability,na.rm=T)
#mean attitude towards enemy-targets, control
not_shamed_enemy <- not_shamed[ which(not_shamed$target_ally==0), ]
mean(not_shamed_enemy$target_favorability,na.rm=T)
